import tkinter as tk
window = tk.Tk()
window.title('hello thinter')
height= window.winfo_screenheight()
width= window.winfo_screenwidth()
window.geometry('400x200+%d+%d'%((width-400)/2,(height-200)/2))
var1 = tk.IntVar()
var2 = tk.IntVar()
b1 = tk.Checkbutton(window,text="python",variable=var1).pack()
b2 = tk.Checkbutton(window,text="java",variable=var2).pack()
window.mainloop()




# # 提交选中的数据

import tkinter as tk
def A():
    param = [var1.get(),var2.get()]
    print("选中的数据为",param)
window = tk.Tk()
window.title('hello thinter')
height= window.winfo_screenheight()
width= window.winfo_screenwidth()
window.geometry('400x200+%d+%d'%((width-400)/2,(height-200)/2))
var1 = tk.IntVar()
var2 = tk.IntVar()
b1 = tk.Checkbutton(window,text="python",variable=var1).pack()
b2 = tk.Checkbutton(window,text="java",variable=var2).pack()

tk.Button(text="提交选中的数据",command=A).pack()

window.mainloop()






# # 选中的数据为 [0, 1]

# # 0代表未选中，1代表被选中

# # 设置默认选中

import tkinter as tk

def A():
    param = [var1.get(),var2.get()]
    print("选中的数据为",param)
window = tk.Tk()
window.title('hello thinter')
height= window.winfo_screenheight()
width= window.winfo_screenwidth()
window.geometry('400x200+%d+%d'%((width-400)/2,(height-200)/2))
var1 = tk.IntVar()
var2 = tk.IntVar()
var1.set(1)  #设置默认选中
b1 = tk.Checkbutton(window,text="python",variable=var1).pack()
b2 = tk.Checkbutton(window,text="java",variable=var2).pack()

tk.Button(text="提交选中的数据",command=A).pack()

window.mainloop()
